# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pin
pkgver=3.28.r98749
_pkgver=3.28-98749-g6643ecee5
pkgrel=1
pkgdesc='A dynamic binary instrumentation tool.'
groups=('blackarch' 'blackarch-automation' 'blackarch-binary'
        'blackarch-reversing')
arch=('x86_64')
url="https://software.intel.com/en-us/articles/pin-a-binary-instrumentation-tool-downloads"
license=('custom')
depends=('gcc' 'lib32-gcc-libs')
makedepends=('gcc' 'lib32-gcc-libs' 'make')
options=('!strip' 'staticlibs')
source=("https://software.intel.com/sites/landingpage/pintool/downloads/$pkgname-$_pkgver-gcc-linux.tar.gz")
sha512sums=('9bf273ffd48b11d4fd192b91eb561a6badfd6324e9bba421b68b1bec68b0fd27d96eb9a1b18c836450e73b4e3160adeeb8ccb96ae914a7b09119338dfef358d1')

build() {
  cd "$pkgname-$_pkgver-gcc-linux/source/tools/ManualExamples"

  TARGET=intel64 make

  TARGET=ia32 make
}

package() {
  cd "$pkgname-$_pkgver-gcc-linux"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  ln -fs "/usr/share/$pkgname/$pkgname" "$pkgdir/usr/bin/$pkgname"
}

